<?
set_include_path('./../../nearestCaches/library' . PATH_SEPARATOR . get_include_path());
require 'functions.php';
$lang = getLang();
if ($_GET["name"] <> '') { $name = $_GET["name"]; } else { $name = $lang['waypoint']; }
header("Content-Description: File Transfer");
header("Content-Type: application/force-download; charset=\"UTF-8\"");
header("Content-Disposition: attachment; filename=\"".str_Replace(' ', '_', urldecode($name)).".kml\"");

$kml = '<?xml version="1.0" encoding="UTF-8"?><kml xmlns="http://earth.google.com/kml/2.2"><Placemark><name>'.urldecode($name).'</name><description>'.urldecode($_GET["desc"]).'</description><Point><coordinates>'.$_GET['lon'].','.$_GET['lat'].'</coordinates></Point></Placemark></kml>';
print $kml;
?>
